/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.general.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author lizardo
 */
@Entity
@Table(name = "gen_modulo")
@NamedQueries({@NamedQuery(name = "Modulo.findAll", query = "SELECT m FROM Modulo m"), @NamedQuery(name = "Modulo.findByModCodigo", query = "SELECT m FROM Modulo m WHERE m.modCodigo = :modCodigo"), @NamedQuery(name = "Modulo.findByModNombre", query = "SELECT m FROM Modulo m WHERE m.modNombre = :modNombre"), @NamedQuery(name = "Modulo.findByModDescripcion", query = "SELECT m FROM Modulo m WHERE m.modDescripcion = :modDescripcion"), @NamedQuery(name = "Modulo.findByModOrden", query = "SELECT m FROM Modulo m WHERE m.modOrden = :modOrden")})
public class Modulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "mod_codigo")
    private Integer modCodigo;
    @Basic(optional = false)
    @Column(name = "mod_nombre")
    private String modNombre;
    @Basic(optional = false)
    @Column(name = "mod_descripcion")
    private String modDescripcion;
    @Basic(optional = false)
    @Column(name = "mod_orden")
    private int modOrden;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modCodigo", fetch = FetchType.LAZY)
    private List<Menu> menuList;

    public Modulo() {
    }

    public Modulo(Integer modCodigo) {
        this.modCodigo = modCodigo;
    }

    public Modulo(Integer modCodigo, String modNombre, String modDescripcion, int modOrden) {
        this.modCodigo = modCodigo;
        this.modNombre = modNombre;
        this.modDescripcion = modDescripcion;
        this.modOrden = modOrden;
    }

    public Integer getModCodigo() {
        return modCodigo;
    }

    public void setModCodigo(Integer modCodigo) {
        this.modCodigo = modCodigo;
    }

    public String getModNombre() {
        return modNombre;
    }

    public void setModNombre(String modNombre) {
        this.modNombre = modNombre;
    }

    public String getModDescripcion() {
        return modDescripcion;
    }

    public void setModDescripcion(String modDescripcion) {
        this.modDescripcion = modDescripcion;
    }

    public int getModOrden() {
        return modOrden;
    }

    public void setModOrden(int modOrden) {
        this.modOrden = modOrden;
    }

    public List<Menu> getMenuList() {
        return menuList;
    }

    public void setMenuList(List<Menu> menuList) {
        this.menuList = menuList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (modCodigo != null ? modCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modulo)) {
            return false;
        }
        Modulo other = (Modulo) object;
        if ((this.modCodigo == null && other.modCodigo != null) || (this.modCodigo != null && !this.modCodigo.equals(other.modCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.general.be.Modulo[modCodigo=" + modCodigo + "]";
    }

}
